package model;

import java.io.IOException;

import view.ClientGUI;

public class InputRunnable implements Runnable {

	// Attribute

	// Konstruktoren
	public InputRunnable() {
		super();
	}

	// Methoden
	@Override
	public void run() {
		while (!controller.Client.close) {
			try {
				Object o = controller.Client.ois.readObject();
				controller.Client.analyzeObject(o);
				if (!controller.Client.close) {
				}
			} catch (IOException ex) {
				if (!controller.Client.close) {
					view.ClientGUI.createError(ClientGUI.ErrorType.CONNECTION);
					try {
						controller.Client.ois.close();
						controller.Client.socket.close();
						controller.Client.clientGUI.returnToLogin();
						break;
					} catch (Exception e) {
					}
				}
			} catch (Exception e) {
			}
		}
	}

}
